﻿@using LY.Business.ServiceImpl
@using LY.Entity
@using LY.Entity.Entities
@using LY.Interface
<script src="~/Scripts/mustache.js"></script>

@if (Model.ToString() == "list")
{
    <div class="lf-tit mb20">
        <span class="fl"><i class="love mr10"></i><span class="lf-text">猜你喜欢</span></span>
        <a href="javascript:;" id="guess_change" class="changeLink"><i class="change mr10"></i>换一组</a>
    </div>
    <div class="lr-fav">
        <ul class="infos" style="width: 1220px" id="guess_div">
        </ul>
    </div> 
    <!--加载模版-->
    <script type="text/template" id="CainixihuangTemp">
      <div class="query-right-result-list">
                        <li class="info pr mb20 fl">
                            <div node-type="qRemind" class="pr">
                                <a href="/Default/Detail/{{Id}}" style="margin-top: 0px;" target="_self" class="link-pic">
                                    <img class="lazyout"   src="{{ProjectThumImage}}" height="90" width="120" style="display: inline;">
                                </a> 
                                <div class="q-mask" itemvotype="2" style="height: 0px; overflow: hidden;"></div>
                            </div>
                            <div class="clear"></div>
                            <i class="smll-icons zc-icons">{{ProjectStatusName}}</i> 
                            <a class="support" id="support_{{Id}}" onclick="zanclick({{Id}},2)" style="display: none;">
                                <i class="support-icons"></i><span>{{zan}}
                                                             </span>
                            </a> 

                            <div class="i-tits mb10">
                                <a href="/Default/Detail/{{Id}}" target="_self">
                                    <h4 class="link-tit mt5">{{ProjectName}}</h4>
                                </a>
                            </div>
                            <div class="p-outter">
                                <div class="p-bar">
                                    <span class="p-b-slide" style="width: 100%"></span>
                                </div>
                                <div class="p-items">
                                    <ul class="p-i-infos">
                                        <li class="fore1">
                                            <p class="p-percent">{{StrProjectPercent}}</p>

                                            <p class="p-extra">已达</p>
                                            <span class="v-line"></span>
                                        </li>
                                        <li class="fore2">
                                            <p class="p-percent">{{StrCurrentAmount}}</p>

                                            <p class="p-extra">已筹</p>
                                            <span class="v-line"></span>
                                        </li>
                                        <li class="fore3">
                                            <p class="p-percent">{{StrRemainDays}}<</p>
                                            <p class="p-extra">剩余时间</p>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="shade">
                                <ul>
                                    <li>支持：<span>
                                             {{Zc}}
                                           </span></li>
                                    <li>关注：<span>
                                              {{Guanzhu}}
                         
                                           </span></li>
                                    <li id="shadePraiseLi16664">赞：
                                        <span>{{Zan}}
                                        </span>
                                    </li>
                                </ul>
                            </div>
                        </li>
                    </div> 
    </script>
}
else
{
    
    <div id="fav" class="fav">
        <div class="fav-inner">
            <div class="fav-tit">
                <h3><i></i>猜你喜欢</h3>
                <a class="changeLink" href="javascript:void(0);" id="cnxh"><i></i>换一换</a>
            </div>
            <div class="query-result">
                <div id="guess_div" class="query-right-result-outer" style="padding-top: 15px;">
                </div>
            </div>
        </div>
    </div> 
    <script type="text/template" id="CainixihuangTemp">
     <div class="query-right-result-list">
        <div class="q-pic" style="float:left;width:120px;">
            <a target="_self"   href="/Default/Detail/{{Id}}">
                <img class="lazyout-guess" " src="{{ProjectThumImage}}" width="120" height="90" style="display: inline;"></a>
        </div>
         <div style="float:right;width:180px;">
             <div class="q-title"><a   target="_self" href="/Default/Detail/{{Id}}">{{ProjectName}}</a></div>
            <div class="q-progress">
                <div class="q-progress-bar"><span style="border-radius: 8px; width: 6%"></span></div>
                <div class="q-em ing">{{ProjectStatusName}}</div>
            </div>
            <div class="q-info clearfix">
                <div class="q-info-1">
                    <p class="mb4">{{StrProjectPercent}}</p>
                    <span class="gray">已达</span>
                </div>
                <div class="q-info-2">
                    <p class="mb4">{{StrCurrentAmount}}</p>
                    <span class="gray">已筹</span>
                </div>
                <div class="q-info-3">
                    <p class="mb4">{{StrRemainDays}}</p>
                    <span class="gray">剩余时间</span>
                </div>
            </div>
            <div class="q-support"><span>支持:<span class="f-Arial">{{Zc}}</span></span><span class="ml10">关注:<span class="f-Arial">{{Guanzhu}}</span></span><span class="ml10 mr10">赞:<span class="f-Arial">{{Zan}}</span></span></div>
         </div>
     </div> 
        <div style="clear:both;"></div>
    </script>
}
<script>
    $(function () {
        $(".changeLink").click(function () {
            LoadData(1);
        });
        LoadData(0);
    });
    function LoadData(isRefresh) {
        var url = '@Url.Action("Cainixihuang", "Project")?isRefresh=' + isRefresh;

        $.ajax({
            url: url,
            type: 'Post',
            dataType: 'json',
            success: function (result) {

                if (result.Data == null)
                    return;
                $("#guess_div").html("");
                $.each(result.Data, function (index, row) {
                    row.ProjectStatusName = row.ProjectStatus == 8 ? "项目预热" : "众筹中";
                    var template = $('#CainixihuangTemp').html();
                    var data = Mustache.render(template, row);
                    $("#guess_div").append(data);
                });

            }
        });
    }
</script>
